package chapter5;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/3/7 9:09
 */
public class Book {
    boolean checkedOut = false;

    public Book(boolean checkedOut) {
        this.checkedOut = checkedOut;
    }

    public void checkIn() {
        checkedOut = false;
    }

    @Override
    protected void finalize() throws Throwable {
        if (checkedOut) {
            System.out.println("Error:checked out");
        }
        super.finalize();
    }
}
